package com.fish.start.animation.Attr;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

import com.fish.start.animation.AnimationSet;
import com.fish.start.animation.views.FishView;

public  class BitmapWay extends AbstractWay {
	
	public BitmapWay(FishView aFishView,Bitmap aBitmap){
		mFishView = aFishView;
		mBitmap = aBitmap;
		oldBitmap = aBitmap;
		mw = mFishView.mScreenWidth;
		mh = mFishView.mScreenHeight;
		mow = mBitmap.getWidth();
		moh = mBitmap.getHeight();
		oOldw = mBitmap.getWidth();
		oOldh = mBitmap.getHeight();
	}
	@Override
	public void createAnimatons(AnimationSet as)throws Exception{
		mBitmap = Bitmap.createScaledBitmap(mBitmap, mFishView.mScreenWidth, mFishView.mScreenHeight, true);
		mow = mBitmap.getWidth();
		moh = mBitmap.getHeight();
		setPosition();
		as.push(this);
	}

	@Override
	public void draw(Canvas aCanvas) {
		aCanvas.drawBitmap(mBitmap, mx-(float)mow/2, my-(float)moh/2,mPaint);
	}
	
	protected Object clone() { 
		Object o = null;
		o = super.clone();
		return o;
	}
}
